import pytest
from a3mall.Tools.tools import ApiClient
from a3mall.Tools.mysql import db

jdbc = db(
    host='10.59.9.12',
    password='yidong666',
    database='a3mall',
    user='root'
)

@pytest.fixture
def client():
    return ApiClient("http://10.59.9.12:7001/")

class Test_a3mall():
    token = None
    spid = None
    # 登录
    def test_login_1(self, client):
        """测试登录成功"""
        data = {'username': '19064013675', 'password': '123456'}
        response = client.post(path="api/public/login", json_data=data)
        print(response.json())


    def test_login_2(self, client):
        """测试登录用户名为空"""
        data = {'username': ' ', 'password': '123456'}
        response = client.post(path="api/public/login", json_data=data)
        print(response.json())


    def test_login_3(self, client):
        """测试登录密码为空"""
        data = {'username': '19064013675', 'password': ''}
        response = client.post(path="api/public/login", json_data=data)
        print(response.json())


    def test_login_4(self, client):
        """测试登录pwd有误"""
        data = {'username': '19064013675', 'password': '88888888'}
        response = client.post(path="api/public/login", json_data=data)
        print(response.json())


    def test_login_5(self, client):
        """测试登录成功"""
        data = {'username': '1111111111', 'password': '123456'}
        response = client.post(path="api/public/login", json_data=data)
        print(response.json())


    def test_login_6(self, client):

        data = {'username': '101001', 'password': '123456'}
        response = client.post(path="api/public/login", json_data=data)
        print(response.json())


    def test_login_7(self, client):

        data = {'username': '190640136758888', 'password': '123456'}
        response = client.post(path="api/public/login", json_data=data)
        print(response.json())


    def test_login_8(self, client):

        data = {'username': '19064013675', 'password': '########'}
        response = client.post(path="api/public/login", json_data=data)
        print(response.json())


    def test_login_9(self, client):

        data = {'username': '@@@@@@@', 'password': '123456'}
        response = client.post(path="api/public/login", json_data=data)
        print(response.json())


    def test_login_10(self, client):

        data = {'username': '19064013675', 'password': 'SQL=!'}
        response = client.post(path="api/public/login", json_data=data)
        print(response.json())

if __name__ == '__main__':
    pytest.main()